package com.qf.electronic.controller;

import com.qf.electronic.common.R;
import com.qf.electronic.common.ResponseStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;

@RestController
@ControllerAdvice //全局异常处理
public class ExceptionController {

    @ExceptionHandler
    public R<?> handleException(Exception e){
        return R.error(ResponseStatus.INVALID_PARAMETER.getStatus(), e.getMessage());
    }
}
